package com.college.heyuhua.dao;

import com.college.heyuhua.model.BBSInfo;
import com.college.heyuhua.model.BBSInfoSecond;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by 赵东坡 on 2019/1/27.
 * Time:11:43
 * 宇宙无敌赵牛逼，祈求永无bug
 */
@Mapper
@Component
public interface BBSInfoMapper {

    @Select("<script>" +
            "select * " +
            "from bbsinfo b " +
            "where b.nid = #{nid} " +
            "and b.style = #{style} " +
            "order by b.bbsdate " +
            "</script>")
    List<BBSInfo> getBBSInfoList(@Param("nid") long nid,@Param("style") String style);


    @Select("<script>" +
            "select * " +
            "from bbsinfo b " +
            "where b.nid = #{nid} " +
            "and b.style = #{style} " +
            "order by b.bbsdate "+
            "</script>")
    List<BBSInfoSecond> getBBSInfoListSecond(@Param("nid") long nid,@Param("style") String style);



    @Insert("<script>" +
            "insert into bbsinfo(uid,bbscontent,style,nid) " +
            "values(#{uid},#{bbscontent},#{style},#{nid}) " +
            "</script>")
    boolean insertContent(@Param("nid") long nid,@Param("bbscontent") String bbscontent,@Param("style") String style,@Param("uid") long uid);
}
